﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;

namespace Crawler.Configuration
{
    public class AuthDataCollection : ConfigurationElementCollection
    {

        public override ConfigurationElementCollectionType CollectionType
        {
            get
            {
                return
                    ConfigurationElementCollectionType.AddRemoveClearMap;
            }
        }

        public AuthDataElement this[int index]
        {
            get { return (AuthDataElement)base.BaseGet(index); }
        }

        public new AuthDataElement this[string name]
        {
            get { return (AuthDataElement)base.BaseGet(name); }
        }

        public int IndexOf(AuthDataElement action)
        {
            return BaseIndexOf(action);
        }

        public void Add(AuthDataElement action)
        {
            BaseAdd(action);
        }

        public void Remove(AuthDataElement action)
        {
            if (BaseIndexOf(action) > 0)
            {
                BaseRemove(action.Key);
            }
        }

        public void RemoveAt(int index)
        {
            BaseRemoveAt(index);
        }

        public void Remove(string name)
        {
            BaseRemove(name);
        }

        public void Clear()
        {
            BaseClear();
        }


        protected override ConfigurationElement CreateNewElement()
        {
            return new AuthDataElement();
        }

        protected override object GetElementKey(ConfigurationElement element)
        {
            return ((AuthDataElement)element).Key;
        }
    }
}
